/// describe
///
/// created by hujintao
/// created at 2021/5/19
//

import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:oktoast/oktoast.dart';
import 'package:flutter/material.dart';

class Toast {

  static show(String msg, {duration = 2000, GestureTapCallback? onDismiss}) {
    showToast(msg,
        backgroundColor: Colors.black.withOpacity(0.8),
        textStyle: TextStyle(
          color: Colors.white,
          fontSize: ScreenUtil().setSp(30),
        ),
        duration: Duration(milliseconds: duration),
        dismissOtherToast: true,
        onDismiss: onDismiss
    );
  }

  static imShow(String msg, {duration = 2000}) {
    showToast(msg,
        backgroundColor: Color(0xff333333).withOpacity(0.65),
        textStyle: TextStyle(
          color: Colors.white,
          fontSize: ScreenUtil().setSp(30),
        ),
        duration: Duration(milliseconds: duration),
        dismissOtherToast: true);
  }

  static heartShow(String msg, {duration = 2000}) {
    showToast(msg,
        backgroundColor: Color(0xffFFF2F4).withOpacity(0.9),
        textStyle: TextStyle(
          color: Color(0xffFF7E98),
          fontSize: ScreenUtil().setSp(30),
        ),
        duration: Duration(milliseconds: duration),
        dismissOtherToast: true);
  }

  static cancelToast() {
    dismissAllToast();
  }
}
